
package chapter1;

import javax.swing.*;
import java.awt.*;
/**
 * Բ
 * @author isource
 *
 */
public class Ex3 extends JPanel {
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        int w = this.getWidth();
        int h = this.getHeight();
        int d = Math.min(w, h) - 10;
        g.drawOval((w-d)/2, (h-d)/2, d, d);
    }
    
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        Ex3 panel = new Ex3();
        frame.add(panel);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setBounds(200, 100, 500, 400);
        frame.setVisible(true);
    }   
    
}
